fix(l1): have block execution stop when block's gas limit is surpassed by executing a transaction #5185
+16
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The ef test for Osaka that's run in the Hive integration testing site named
osaka/eip7825_transaction_gas_limit_cap/test_tx_gas_limit.py::test_tx_gas_larger_than_block_gas_limit[fork_Osaka-blockchain_test_engine-exceed_block_gas_limit_False]is failing due to an error message mismatch. See here.Besides we don't have any logic implemented when processing a block to stop computing transactions once the block's gas limit was surpassed.
Description
This pr adds a conditional to check if the block's gas limit can be potentially surpassed, and in that case stop computing any other transactions. So if tx.gas_limit > gas_available the block's execution must stop with an exception, as the spec says here.
To test it I run:
This tx.gas_limit > gas_available check was already implemented for block building, as we can see here in ethrex/crates/blockchain/payload.rs The main difference is that instead of throwing an exception when the condition is false we keep searching for a transaction with a smaller gas_limit so it can be included in the block that's being built.